n, m = map(int, input().split())
yanse = [map(int, input().split()) for i in range(n)]
y = set(yanse)
for i in range(m):
    op = list(map(int, input().split()))
    if op == 1:
        x = op[1]
        y = op[2]
        a = yanse.count(x)
        if a == n:
            break
        elif a < n:
            for i in range(a):
                yanse[yanse.index(x)] = y
    else:
        if yanse.count(yanse[0]) == n:
            print(1)
        else:
            print('实验')
# 不知道哪里出了问题
